import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TeacherInfo extends StatefulWidget {
  @override
  _TeacherInfoState createState() => _TeacherInfoState();
}

class _TeacherInfoState extends State<TeacherInfo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: const Color(0xff23AFDC),
        elevation: 0,
        title: Text('教练信息'),
        centerTitle: true,
      ),
      body: ListView(
        children: <Widget>[
          Padding(
            padding: EdgeInsets.fromLTRB(20, 16, 20, 16),
            child: Row(
              children: <Widget>[
                Image.asset(
                  'images/icon.png',
                  height: 48,
                  width: 48,
                ),
                SizedBox(
                  width: 10,
                ),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      '王二麻',
                      style: TextStyle(color: Colors.black, fontSize: 16),
                    ),
                    SizedBox(
                      height: 6,
                    ),
                    Row(
                      children: <Widget>[
                        Text(
                          '带教人数：11',
                          style: TextStyle(color: Colors.black, fontSize: 10),
                        ),
                        SizedBox(
                          width: 35,
                        ),
                        Text(
                          '学生合格率：98%',
                          style: TextStyle(color: Colors.black, fontSize: 10),
                        ),
                      ],
                    ),
                  ],
                ),
              ],
            ),
          ),
          Container(
            height: 4,
            color: Colors.grey[200],
          ),
          Padding(
            padding: EdgeInsets.fromLTRB(20, 8, 20, 8),
            child: Column(
              children: <Widget>[
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Padding(
                      padding: EdgeInsets.only(bottom: 8),
                      child: Text(
                        '学员评价(4)',
                        style: TextStyle(
                          color: Color(0xff23AFDC),
                          fontSize: 14,
                        ),
                      ),
                    ),
                    GestureDetector(
                      onTap: () {},
                      child: Image.asset(
                        'images/icon_comment.png',
                        width: 18,
                        height: 20,
                      ),
                    ),
                  ],
                ),
                ListView(
                  shrinkWrap: true,
                  physics: NeverScrollableScrollPhysics(),
                  children: _addComments(),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }

  _addComments() {
    List<Widget> listComments = List();
    for (int i = 0; i < 10; i++) {
      listComments.add(
        Column(
          children: <Widget>[
            Padding(
              padding: EdgeInsets.fromLTRB(0, 6, 0, 7),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
//            Expanded(
//              child: Text('认真和善，执教水平很高,认真和善，执教水平很高,认真和善，执教水平很高',softWrap: true,
//                style: TextStyle(color: Colors.black,fontSize: 12),),
//            ),
                  SizedBox(
                    width: 250,
                    child: Text(
                      '认真和善，执教水平很高,认真和善，执教水平很高,认真和善，执教水平很高',
                      style: TextStyle(color: Colors.black, fontSize: 12),
                    ),
                  ),
                  Text(
                    '18.01.13',
                    style: TextStyle(color: Color(0xff999999), fontSize: 10),
                  ),
                ],
              ),
            ),
            Container(
              height: 1,
              color: Color(0xffF0F0F0),
            ),
          ],
        ),
      );
    }
    return listComments;
  }
}
